#include <stdio.h>
#include <string.h>

#define STRING_LENGTH 200
#define DELETE_LENGTH 10

int main()
{
    char str[STRING_LENGTH] = {0};
    while (fgets(str, STRING_LENGTH, stdin) != NULL) {
        char to_delete[DELETE_LENGTH];
        fgets(to_delete, DELETE_LENGTH, stdin);

        int str_len = strlen(str) - 1;
        str[str_len] = '\0';
        int bias = 0;
        for (int i = 0; i < str_len; i++) {
            if (str[i+bias] == to_delete[0] && (i == 0 || str[i+bias-1] != to_delete[0])) {
                while (str[i + (++bias)] == to_delete[0])
                    ;
            }
            str[i] = str[i + bias];
        }
        printf("%s\n", str);
    }
}